package net.biancheng.bean;

import lombok.Data;
import lombok.EqualsAndHashCode;
import net.biancheng.common.core.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.List;

/**
 * @author: lb
 * @date: 2023/8/1 9:45
 * @desc: 部门
 **/
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@org.hibernate.annotations.Table(appliesTo = "sys_dept", comment = "部门表")
public class SysDept extends BaseEntity {

    @Column(name = "dept_name", columnDefinition = "varchar(100) comment '部门名称'")
    private String deptName;//部门名称

    @Column(name = "parent_id", columnDefinition = "bigint(20) comment '父级ID'")
    private Long parentId;//父级ID

    @Column(name = "ancestors", columnDefinition = "varchar(255) comment '祖级列表，ID集合'")
    private String ancestors;//祖级列表，ID集合

    @Column(name = "order_num", columnDefinition = "int(10) comment '显示顺序'")
    private Integer orderNum;//显示顺序

    @Column(name = "charge_person", columnDefinition = "varchar(255) comment '负责人'")
    private String chargePerson;//负责人

    @Column(name = "phone", columnDefinition = "varchar(11) comment '联系电话'")
    private String phone;//联系电话

    @Column(name = "status", columnDefinition = "char(1) comment '状态 （0启用 1禁用）'")
    private String status;//状态 0-启用 1-禁用

    /** 子级部门 */
    @Transient
    private List<SysDept> children = new ArrayList<SysDept>();

}
